require "test/unit"
$:.unshift File.dirname(__FILE__) + '/../lib'

require 'Eyealike'

class CollectionTestCase < Test::Unit::TestCase
  
  def test_collection_lifecycle

    client = Eyealike.new("V5VF5X79W1OCW6KQBGOM", "kQWhIzEHZjXeAfQozfcb7/AVtmZYjL7rTGIpm+J/", false, "vsp02", 8080)
  
    
    assert_not_nil(client, message = "Client initialization failed")
    
    c = ImageCollection.new("ruby-itest-collection", "ruby-itest-collection")
    
     assert_not_nil(c, message = "Collection initialization failed")
    
    created_c = client.create_or_update_collection(c)
    
    assert_not_nil(c)
    
    assert_not_nil(created_c.collection_name)
    
    assert_not_nil(created_c.collection_id)
    
    created_c = client.create_or_update_collection(created_c)
    
    assert(client.delete_collection(created_c.collection_id))
   
  end
end